//
//  LTFBaseModel.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/14.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "LTFBaseModel.h"

@implementation LTFBaseModel
//初始化
- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}
//便利构造器
+ (instancetype)baseModelWithDictionary:(NSDictionary *)dictionary {
    id model = [[[self class] alloc] initWithDictionary:dictionary];
    return [model autorelease];
}

//遍历方法
+ (NSMutableArray *)BaseModelByArray:(NSArray *)array {
    NSMutableArray *mArray = [NSMutableArray array];
    for (NSDictionary *dic in array) {
        @autoreleasepool {
            id model = [[self class] baseModelWithDictionary:dic];
            [mArray addObject:model];
        }
    }
    
    return mArray;
}
@end
